# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models

class Migration(SchemaMigration):

    def forwards(self, orm):
        
        # Adding model 'Sale'
        db.create_table('shop_sale', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('datetime', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(2012, 3, 12, 20, 39, 25, 679000))),
        ))
        db.send_create_signal('shop', ['Sale'])

        # Adding field 'MovementOfGoods.sale'
        db.add_column('shop_movementofgoods', 'sale', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['shop.Sale'], null=True), keep_default=False)


    def backwards(self, orm):
        
        # Deleting model 'Sale'
        db.delete_table('shop_sale')

        # Deleting field 'MovementOfGoods.sale'
        db.delete_column('shop_movementofgoods', 'sale_id')


    models = {
        'shop.movementofgoods': {
            'Meta': {'object_name': 'MovementOfGoods'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'kol': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'product': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['shop.Product']"}),
            'receiptofgoods': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['shop.ReceiptOfGoods']", 'null': 'True'}),
            'sale': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['shop.Sale']", 'null': 'True'}),
            'sum': ('django.db.models.fields.FloatField', [], {})
        },
        'shop.product': {
            'Meta': {'object_name': 'Product'},
            'code': ('django.db.models.fields.CharField', [], {'max_length': '250'}),
            'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '250'}),
            'price': ('django.db.models.fields.FloatField', [], {}),
            'purchase_price': ('django.db.models.fields.FloatField', [], {})
        },
        'shop.receiptofgoods': {
            'Meta': {'object_name': 'ReceiptOfGoods'},
            'datetime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2012, 3, 12, 20, 39, 25, 679000)'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
        },
        'shop.sale': {
            'Meta': {'object_name': 'Sale'},
            'datetime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2012, 3, 12, 20, 39, 25, 679000)'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
        }
    }

    complete_apps = ['shop']
